/*
 * EDAS2 - TetraTech, Inc.
 *
 * Distributable under GPL license.
 * See terms of license at gnu.org.
 */
package com.tetratech.edas2.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * FrequencyClassDescriptor generated by hbm2java
 */
@Entity
@Table(name = "ED_FREQUENCY_CLASS_DESCRIPTOR")
public class FrequencyClassDescriptor extends AttributableUpdateRetireEntity
		implements
			java.io.Serializable {

	private Long uid;
	private FrequencyClassType frequencyClassType;
	private String name;
	private String description;
	private Set<ResultFrequencyClass> resultFrequencyClasses = new HashSet<ResultFrequencyClass>(
			0);

	public FrequencyClassDescriptor() {
	}

	public FrequencyClassDescriptor(Long uid,
			FrequencyClassType frequencyClassType, String name) {
		this.uid = uid;
		this.frequencyClassType = frequencyClassType;
		this.name = name;
	}

	@Id
	@Column(name = "FCDSC_UID", unique = true, nullable = false, precision = 6, scale = 0)
	@GeneratedValue(generator = "FrequencyClassDescriptorSequence")
	@SequenceGenerator(name = "FrequencyClassDescriptorSequence", sequenceName = "FCDSC_SEQ", allocationSize = 1)
	//@NotNull
	public Long getUid() {
		return this.uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FCTYP_UID", nullable = false)
	@NotNull
	public FrequencyClassType getFrequencyClassType() {
		return this.frequencyClassType;
	}

	public void setFrequencyClassType(FrequencyClassType frequencyClassType) {
		this.frequencyClassType = frequencyClassType;
	}

	@Column(name = "FCDSC_NAME", nullable = false, length = 50)
	@NotNull
	@Length(max = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "FCDSC_DESC", length = 200)
	@Length(max = 200)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "frequencyClassDescriptor")
	public Set<ResultFrequencyClass> getResultFrequencyClasses() {
		return this.resultFrequencyClasses;
	}

	public void setResultFrequencyClasses(
			Set<ResultFrequencyClass> resultFrequencyClasses) {
		this.resultFrequencyClasses = resultFrequencyClasses;
	}

}
